#include <stdio.h>
#include "com_imay_videorecord_FFmpegKit.h"
#include <jni.h>
#include <ffmpeg.h>
//Output FFmpeg's av_log()
int ffmpegmain(int argc, char **argv);

JNIEXPORT jint JNICALL Java_com_imay_videorecord_FFmpegKit_run
        (JNIEnv * env, jobject thiz, jint cmdnum, jobjectArray cmdline){

    int argc=cmdnum;
    char** argv=(char**)malloc(sizeof(char*)*argc);
    int i=0;
    for(i=0;i<argc;i++)
    {
        jstring string=(*env)->GetObjectArrayElement(env,cmdline,i);
        const char* tmp=(*env)->GetStringUTFChars(env,string,0);
        argv[i]=(char*)malloc(sizeof(char)*1024);
        strcpy(argv[i],tmp);
    }
    return ffmpegmain(argc,argv);
}

